package com.fivetalks.service;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.fivetalks.dao.MemberDAO;
import com.fivetalks.domain.Member;


@Service(value="memberService")
@Transactional
public class MemberService {
	@Autowired
	MemberDAO memberDAO;
	
	
	@Transactional(readOnly = true)
	public List<Member> getMemberList(){
		List<Member> list = memberDAO.getAll();
		return list;
	}
	
	@Transactional
	public Member saveMember(Member member){
		memberDAO.save(member); //영속적,post에 id가 할당.
		return member;
	}
	
	@Transactional(readOnly = true)
	public boolean emailExists(String email) {
		return memberDAO.rowExists("email", email);
	}
	
	@Transactional(readOnly = true)
	public boolean loginExists(String email, String password) {
		return memberDAO.rowExists2("email", email, "password", password);
	}
	
	
}
